-----BEGIN PGP SIGNED MESSAGE-----

=============================================================================
FreeBSD-SA-02:43.bind                                       Security Advisory
                                                          The FreeBSD Project

Topic:          multiple vulnerabilities in BIND [REVISED]

Category:       core
Module:         bind
Announced:      2002-11-15
Credits:        ISS X-Force <xforce@iss.net>
Affects:        All released versions of FreeBSD
Corrected:      2002-11-14 05:15:15 UTC (RELENG_4)
                2002-11-14 02:05:57 UTC (RELENG_4_7)
                2002-11-14 03:18:41 UTC (RELENG_4_6)
                2002-11-14 04:05:12 UTC (RELENG_4_5)
                2002-11-14 05:11:57 UTC (RELENG_4_4)
FreeBSD only:   NO

0.   Revision History

v1.0  2002-11-14  Initial release.
v1.1  2002-11-15  Correct patch instructions.  Clarify workaround.
                      Add CVE references.

I.   Background

BIND 8 is an implementation of the Domain Name System (DNS) protocols.

II.  Problem Description

ISS X-Force has disclosed several vulnerabilities affecting BIND 8.
The names which ISS has given each vulnerability are used in this
advisory.  The first is a buffer overflow in the BIND 8 code
responsible for creating DNS responses which include SIG resource
records (RRs) from its internal cache (`BIND SIG Cached RR Overflow
Vulnerability').  The second is an error in the BIND 8 code which
constructs a response to an EDNS query (i.e. a query containing OPT
RRs) with a large packet size.  A miscalculation triggers an assertion
failure (`BIND OPT DoS').  The third is a problem in the verification
of SIG RR expiry times, which can result in a null pointer dereference
(`BIND SIG Expiry Time DoS').

III. Impact

BIND SIG Cached RR Overflow Vulnerability:  A remote attacker may be
able to cause a name server with recursion enabled to execute
arbitrary code with the privileges of the name server process.

BIND OPT DoS and BIND SIG Expiry Time DoS: A remote attacker may be
able to cause the name server process to crash.

IV.  Workaround

BIND 9 is not affected by these vulnerabilities.  For those who have
the option, upgrading to BIND 9 is recommended.  BIND 9 is available
in the FreeBSD Ports Collection (ports/net/bind9).  The bind9 port
includes migration notes in /usr/local/share/doc/bind9/misc/migration.

Name servers with recursion disabled are not vulnerable to the `BIND
SIG Cached RR Overflow Vulnerability' nor to the `BIND SIG Expiry Time
DoS'.  To disable recursion, edit the BIND 8 configuration file
(default path /etc/namedb/named.conf) to add `recursion no;' and
`fetch-glue no;' to the options statement.  e.g.,

   options {
       recursion no;
       fetch-glue no;
       /* ... other options ... */
   };

Restart the name server after editing the configuration file.
NOTE: This workaround is only appropriate for name servers
which are authoritative only.  Caching name servers will no longer
function correctly if recursion is disabled.

Restricting recursion to only your own organization's clients (by
means of the `allow-recursion' directive) limits, but does not
eliminate, the impact of these vulnerabilities by making them harder
to exploit.  Restricting recursion in this fashion is generally
recommended.  To restrict recursion, edit the BIND 8 configuration
file to include an `allow-recursion' statement and an address list
appropriate for your organization.  e.g.,

    options {
        allow-recursion { 10.0.0.0/8; };
        /* ... other options ... */
    };

Running BIND 8 as a non-privileged user (rather than as the superuser)
may reduce the impact should the name server be compromised via the
`BIND SIG Cached RR Overflow Vulnerability'.  Running as a
non-privileged user is generally recommended.  Likewise, running BIND
8 in a chroot environment may reduce the impact and is generally
recommended.

V.  Solution

Do one of the following:

1) Upgrade your vulnerable system to 4.7-STABLE; or to the RELENG_4_7,
RELENG_4_6, RELENG_4_5, or RELENG_4_4 security branch dated after the
correction date (4.7-RELEASE-p2, 4.6.2-RELEASE-p5, 4.5-RELEASE-p23,
4.4-RELEASE-p30).

2) To patch your present system:

The following patch has been verified to apply to FreeBSD 4.4, 4.5,
4.6, and 4.7 systems.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:43/bind.patch
# fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:43/bind.patch.asc

b) Execute the following commands as root:

# cd /usr/src
# patch < /path/to/patch
# cd /usr/src/lib/libbind
# make depend && make
# cd /usr/src/lib/libisc
# make depend && make
# cd /usr/src/usr.sbin/named
# make depend && make && make install
# cd /usr/src/libexec/named-xfer
# make depend && make && make install

After upgrading or patching your system, you must restart named.
Execute the following command as root:

# ndc restart

VI.  Correction details

Path                                                             Revision
  Branch
- -------------------------------------------------------------------------
src/contrib/bind/CHANGES
  RELENG_4                                                    1.1.1.7.2.8
  RELENG_4_7                                              1.1.1.7.2.7.2.1
  RELENG_4_6                                              1.1.1.7.2.6.2.2
  RELENG_4_5                                              1.1.1.7.2.4.4.2
  RELENG_4_4                                              1.1.1.7.2.4.2.2
src/contrib/bind/bin/named/db_defs.h
  RELENG_4                                                    1.1.1.2.2.6
  RELENG_4_7                                              1.1.1.2.2.5.2.1
  RELENG_4_6                                              1.1.1.2.2.4.2.2
  RELENG_4_5                                              1.1.1.2.2.3.4.2
  RELENG_4_4                                              1.1.1.2.2.3.2.2
src/contrib/bind/bin/named/db_sec.c
  RELENG_4                                                    1.1.1.1.4.4
  RELENG_4_7                                              1.1.1.1.4.3.4.1
  RELENG_4_6                                              1.1.1.1.4.3.2.1
  RELENG_4_5                                              1.1.1.1.4.2.6.2
  RELENG_4_4                                              1.1.1.1.4.2.4.2
src/contrib/bind/bin/named/ns_defs.h
  RELENG_4                                                    1.1.1.3.2.7
  RELENG_4_7                                              1.1.1.3.2.6.2.1
  RELENG_4_6                                              1.1.1.3.2.5.2.2
  RELENG_4_5                                              1.1.1.3.2.3.4.2
  RELENG_4_4                                              1.1.1.3.2.3.2.2
src/contrib/bind/bin/named/ns_ncache.c
  RELENG_4                                                    1.1.1.2.2.3
  RELENG_4_7                                              1.1.1.2.2.2.4.1
  RELENG_4_6                                              1.1.1.2.2.2.2.1
  RELENG_4_5                                              1.1.1.2.2.1.6.2
  RELENG_4_4                                              1.1.1.2.2.1.4.2
src/contrib/bind/bin/named/ns_req.c
  RELENG_4                                                   1.1.1.2.2.11
  RELENG_4_7                                             1.1.1.2.2.10.2.1
  RELENG_4_6                                              1.1.1.2.2.9.2.2
  RELENG_4_5                                              1.1.1.2.2.7.4.2
  RELENG_4_4                                              1.1.1.2.2.7.2.2
src/contrib/bind/bin/named/ns_resp.c
  RELENG_4                                                    1.1.1.2.2.8
  RELENG_4_7                                              1.1.1.2.2.7.2.1
  RELENG_4_6                                              1.1.1.2.2.6.2.2
  RELENG_4_5                                              1.1.1.2.2.4.4.2
  RELENG_4_4                                              1.1.1.2.2.4.2.2
src/contrib/bind/lib/nameser/ns_name.c
  RELENG_4                                                    1.1.1.2.2.4
  RELENG_4_7                                              1.1.1.2.2.3.2.1
  RELENG_4_6                                              1.1.1.2.2.2.2.2
  RELENG_4_5                                              1.1.1.2.2.1.6.2
  RELENG_4_4                                              1.1.1.2.2.1.4.2
src/contrib/bind/lib/nameser/ns_samedomain.c
  RELENG_4                                                    1.1.1.1.4.1
  RELENG_4_7                                                 1.1.1.1.14.1
  RELENG_4_6                                                 1.1.1.1.12.1
  RELENG_4_5                                                 1.1.1.1.10.1
  RELENG_4_4                                                  1.1.1.1.8.1
src/sys/conf/newvers.sh
  RELENG_4_7                                                1.44.2.26.2.4
  RELENG_4_6                                               1.44.2.23.2.22
  RELENG_4_5                                               1.44.2.20.2.24
  RELENG_4_4                                               1.44.2.17.2.29
- -------------------------------------------------------------------------

VII. References

<URL:http://bvlive01.iss.net/issEn/delivery/xforce/alertdetail.jsp?oid=21469>
<URL:http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2002-1219>
<URL:http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2002-1220>
<URL:http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2002-1221>
<URL:http://www.isc.org/products/BIND/bind-security.html>
<URL:http://www.isc.org/products/BIND/patches/>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iQCVAwUBPdT59FUuHi5z0oilAQEQaAP+O167paqmU92KUMlxKIcjhJeV0eIQST5Y
X3K9VaKBrfE0TCMjJd8j5QnPlRkjPVy8A4wEFrZpEp1Ah94ns8JjyEoiluyA0TFF
Fx6EXnUw5rtOpyKqmdL7FPFSwcJTcv3Zs1eEsaQvRc3E9ygF6e9TJCCayfxB7qMn
SECyOVkopuA=
=9Y+6
-----END PGP SIGNATURE-----
